<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../template/taglib.jsp"%>

<jsp:include page="../template/header.jsp" />

<jsp:include page="../template/staffmenu.jsp" />

<%-- content template --%>
<jsp:include page="../template/contentheader.jsp" />
<%-- put content here --%>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
<fmt:setBundle basename="staff" />
<form action="/LeaveApplicationProcessingSystem/ViewLeaveServlet"
	method="post">
	<h1>
		<fmt:message key="staffleave.view.tite" />
	</h1>
	<table>
		<tr>
			<td align="left">View By Status:</td>
			<td><select name="status">
					<option value="0" <c:if test="${status == 0}">SELECTED</c:if>>All</option>
					<option value="1" <c:if test="${status == 1}">SELECTED</c:if>>Approved</option>
					<option value="2" <c:if test="${status == 2}">SELECTED</c:if>>Applied</option>
					<option value="3" <c:if test="${status == 3}">SELECTED</c:if>>Canceled</option>
					<option value="4" <c:if test="${status == 4}">SELECTED</c:if>>Rejected</option>
					<option value="5" <c:if test="${status == 5}">SELECTED</c:if>>Updated</option>
			</select>
			</td>
			<td><input type="submit" value="Show"></td>
		</tr>
		<tr>
			<td colspan="7">&nbsp;</td>
		</tr>
		<tr>
			<th align="left"><fmt:message key="label.apply.name" /></th>
			<th align="left"><fmt:message key="label.apply.leavetype" /></th>
			<th align="left"><fmt:message key="lable.leave.startdate" /></th>
			<th align="left"><fmt:message key="lable.leave.enddate" /></th>
			<th align="left"><fmt:message key="lable.leave.natureofleave" /></th>
			<th align="left"><fmt:message key="lable.leave.status" /></th>
			<th align="left">&nbsp;</th>
		</tr>

		<c:forEach var="leave" items="${leaves}" varStatus="status">
			<tr>
				<td>${leave.username}</td>
				<td>${leave.leaveTypeName}</td>
				<td><fmt:formatDate pattern="yyyy-MM-dd" value="${leave.startDate}" /></td>
				<td><fmt:formatDate pattern="yyyy-MM-dd" value="${leave.endDate}" /></td>
				<td>${leave.natureOfLeaveName}</td>
				<c:if test="${leave.status == 1}">
					<td>Approved</td>
				</c:if>
				<c:if test="${leave.status == 2}">
					<td>Applied</td>
				</c:if>
				<c:if test="${leave.status == 3}">
					<td>Canceled</td>
				</c:if>
				<c:if test="${leave.status  == 4}">
					<td>Rejected</td>
				</c:if>
				<c:if test="${leave.status  == 5}">
					<td>Updated</td>
				</c:if>
				 <td><c:url var="urlModify" scope="page" value="/staff/manageDetailLeave.jsp">
						<c:param name="id" value="${leave.id}" />
						<c:param name="name" value="${leave.username}" />
						<c:param name="leaveType" value="${leave.leaveType}" />
						<c:param name="startDate" value="${leave.startDate}" />
						<c:param name="endDate" value="${leave.endDate}" />
						<c:param name="natureOfLeave" value="${leave.natureOfLeaveName}" />
						<c:param name="reason" value="${leave.reason}" />
						<c:param name="workDisemmination" value="${leave.workDisemmination}" />
						<c:param name="contactDetails" value="${leave.contactDetails }" />
						<c:param name="status" value="${leave.status}" />
						<c:param name="comment" value="${leave.comment}" />
						<c:param name="back" value="/LeaveApplicationProcessingSystem/ViewLeaveServlet" />
					</c:url>
				    <a href="${urlModify}"><fmt:message key="lable.staff.detail" />
				</a>
				</td>
			</tr>
		</c:forEach>

	</table>
</form>


<jsp:include page="../template/contentfooter.jsp" />
<%-- end of content template --%>

<jsp:include page="../template/footer.jsp" />

